# -*-coding = utf-8 -*-
# @Time : 2022/10/11 19:24
# @Author : Oliver
# @File : 山峰.py
# @Software :PyCharm
length = input()
arr = list(map(int, input().split()))

direction1 = True
direction2 = False
res = []
for i in range(len(arr)):
    maxLength = 1
    for j in range(i + 1, len(arr)):
        if arr[j] > arr[j - 1] and direction1:
            maxLength += 1
            direction1 = False
        elif arr[j] < arr[j - 1] and not direction1:
            maxLength += 1
            direction1 = True

    maxLength2 = 1
    for j in range(i + 1, len(arr)):
        if arr[j] < arr[j - 1] and not direction2:
            maxLength2 += 1
            direction2 = True
        elif arr[j] > arr[j - 1] and direction2:
            maxLength2 += 1
            direction2 = False

    if maxLength > maxLength2:
        res.append(maxLength)
    else:
        res.append(maxLength2)

res.sort()
print(res[len(res) - 1])
